package cn.edu.hnpu.news.utils;

import cn.edu.hnpu.news.common.NewsTypes;

/**
 * 相关API
 * Created by Administrator on 2015/1/18.
 */
public class SuesApiUtils {

    public static final String NEWS_URL_MAIN = "http://www.hnpu.edu.cn/hnit/";
    //各个页面主要url
    public static final String NEWS_URL_ZHYW = "http://www.hnpu.edu.cn/hnit/xxwMore.jsp?id=4";
    public static final String NEWS_URL_MTHG = "http://www.hnpu.edu.cn/hnit/xxwMore.jsp?id=5";
    public static final String NEWS_URL_YBDT = "http://www.hnpu.edu.cn/hnit/xxwMore.jsp?id=6";
    public static final String NEWS_URL_KTRD = "http://www.hnpu.edu.cn/hnit/xxwMore.jsp?id=7";
    public static final String NEWS_URL_SZYW = "http://www.hnpu.edu.cn/hnit/xxwMore.jsp?id=8";
    public static final String NEWS_URL_XYSH = "http://www.hnpu.edu.cn/hnit/xxwMore.jsp?id=9";


    //用于拼接的基础url
    private static final String NEWS_URL_XXYW_PART = "http://news.sues.edu.cn/s/593/t/301/p/31/i";
    private static final String NEWS_URL_XYKX_PART = "http://news.sues.edu.cn/s/593/t/301/p/32/i";
    private static final String NEWS_URL_KJDT_PART = "http://news.sues.edu.cn/s/593/t/301/p/33/i";
    private static final String NEWS_URL_MTJJ_PART = "http://news.sues.edu.cn/s/593/t/301/p/34/i";
    private static final String NEWS_URL_BMXW_PART = "http://news.sues.edu.cn/s/593/t/301/p/35/i";

    private static final String URL_PARAM = "&cur_page=";



    /**
     * 得到相应页面的url
     *
     * @param newsType
     * @param currentPage
     * @return
     */
    public static String getNewsUrl(int newsType, int currentPage) {
//        int totalPage = getTotalPage(newsType);
//        int pageUrl = totalPage - currentPage - 1;  //url中的页码
//        String currentPageString = Integer.toString(pageUrl);
        String url = null;
        switch (newsType) {
            case NewsTypes.NEWS_TPYE_ZHYW:
                url = NEWS_URL_ZHYW;
                break;
            case NewsTypes.NEWS_TPYE_MTHG:
                url = NEWS_URL_MTHG;
                break;
            case NewsTypes.NEWS_TPYE_YBDT:
                url = NEWS_URL_YBDT;
                break;
            case NewsTypes.NEWS_TPYE_KTRD:
                url = NEWS_URL_KTRD;
                break;
            case NewsTypes.NEWS_TPYE_SZYW:
                url = NEWS_URL_SZYW;
                break;
            default:
                break;
        }
        url = url + URL_PARAM + currentPage;
        return url;
    }

}
